forked from deenu713/MyLuaApp-Build-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f99abc
commit 8dbeb6f
Showing
94 changed files
with
6,922 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plugins { | ||
id("java-library") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
dependencies { | ||
api(project(":files")) | ||
api(project(":hashing")) | ||
|
||
implementation(project(":base-annotations")) | ||
|
||
|
||
implementation("com.google.guava:guava:30.1.1-jre") | ||
implementation("com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava") | ||
implementation("com.google.code.findbugs:jsr305:3.0.2") | ||
|
||
|
||
implementation("org.slf4j:slf4j-api:1.7.36") | ||
} |
27 changes: 27 additions & 0 deletions
27
subprojects/snapshots/src/main/java/org/gradle/internal/RelativePathSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal; | ||
|
||
import java.util.Collection; | ||
|
||
public interface RelativePathSupplier { | ||
boolean isRoot(); | ||
|
||
Collection<String> getSegments(); | ||
|
||
String toRelativePath(); | ||
} |
39 changes: 39 additions & 0 deletions
39
...shots/src/main/java/org/gradle/internal/fingerprint/CurrentFileCollectionFingerprint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal.fingerprint; | ||
|
||
import org.gradle.internal.hash.HashCode; | ||
import org.gradle.internal.snapshot.FileSystemSnapshot; | ||
|
||
/** | ||
* A file collection fingerprint taken during this build. | ||
*/ | ||
public interface CurrentFileCollectionFingerprint extends FileCollectionFingerprint { | ||
/** | ||
* Returns the combined hash of the contents of this {@link CurrentFileCollectionFingerprint}. | ||
*/ | ||
HashCode getHash(); | ||
|
||
String getStrategyIdentifier(); | ||
|
||
/** | ||
* Returns the snapshot used to capture these fingerprints. | ||
*/ | ||
FileSystemSnapshot getSnapshot(); | ||
|
||
boolean isEmpty(); | ||
} |
47 changes: 47 additions & 0 deletions
47
...rojects/snapshots/src/main/java/org/gradle/internal/fingerprint/DirectorySensitivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal.fingerprint; | ||
|
||
import org.gradle.internal.file.FileType; | ||
import org.gradle.internal.snapshot.FileSystemLocationSnapshot; | ||
|
||
import java.util.function.Predicate; | ||
|
||
/** | ||
* Specifies how a fingerprinter should handle directories that are found in a filecollection. | ||
*/ | ||
public enum DirectorySensitivity { | ||
/** | ||
* Whatever the default behavior is for the given fingerprinter. For some fingerprinters, the | ||
* default behavior is to fingerprint directories, for others, they ignore directories by default. | ||
*/ | ||
DEFAULT(snapshot -> true), | ||
/** | ||
* Ignore directories | ||
*/ | ||
IGNORE_DIRECTORIES(snapshot -> snapshot.getType() != FileType.Directory); | ||
|
||
private final Predicate<FileSystemLocationSnapshot> fingerprintCheck; | ||
|
||
DirectorySensitivity(Predicate<FileSystemLocationSnapshot> fingerprintCheck) { | ||
this.fingerprintCheck = fingerprintCheck; | ||
} | ||
|
||
public boolean shouldFingerprint(FileSystemLocationSnapshot snapshot) { | ||
return fingerprintCheck.test(snapshot); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...ts/snapshots/src/main/java/org/gradle/internal/fingerprint/FileCollectionFingerprint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal.fingerprint; | ||
|
||
import com.google.common.collect.ImmutableMultimap; | ||
import com.google.common.collect.ImmutableSet; | ||
import com.google.common.collect.ImmutableSortedMap; | ||
import org.gradle.internal.hash.HashCode; | ||
import org.gradle.internal.hash.Hashing; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* An immutable snapshot of some aspects of the contents and meta-data of a collection of files or directories. | ||
*/ | ||
public interface FileCollectionFingerprint { | ||
|
||
/** | ||
* The underlying fingerprints. | ||
*/ | ||
Map<String, FileSystemLocationFingerprint> getFingerprints(); | ||
|
||
/** | ||
* The Merkle hashes of the roots which make up this file collection fingerprint. | ||
*/ | ||
ImmutableMultimap<String, HashCode> getRootHashes(); | ||
|
||
/** | ||
* The absolute paths for the roots of this file collection fingerprint. | ||
*/ | ||
default ImmutableSet<String> getRootPaths() { | ||
return getRootHashes().keySet(); | ||
} | ||
|
||
FileCollectionFingerprint EMPTY = new FileCollectionFingerprint() { | ||
private final HashCode strategyConfigurationHash = Hashing.signature(getClass()); | ||
|
||
@Override | ||
public Map<String, FileSystemLocationFingerprint> getFingerprints() { | ||
return ImmutableSortedMap.of(); | ||
} | ||
|
||
@Override | ||
public ImmutableMultimap<String, HashCode> getRootHashes() { | ||
return ImmutableMultimap.of(); | ||
} | ||
|
||
@Override | ||
public ImmutableSet<String> getRootPaths() { | ||
return ImmutableSet.of(); | ||
} | ||
|
||
@Override | ||
public HashCode getStrategyConfigurationHash() { | ||
return strategyConfigurationHash; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "EMPTY"; | ||
} | ||
}; | ||
|
||
HashCode getStrategyConfigurationHash(); | ||
} |
39 changes: 39 additions & 0 deletions
39
...napshots/src/main/java/org/gradle/internal/fingerprint/FileSystemLocationFingerprint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2016 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal.fingerprint; | ||
|
||
import org.gradle.internal.file.FileType; | ||
import org.gradle.internal.hash.HashCode; | ||
import org.gradle.internal.hash.Hashable; | ||
import org.gradle.internal.hash.Hashing; | ||
|
||
/** | ||
* An immutable fingerprint of some aspects of a file's metadata and content. | ||
* | ||
* Should implement {@link #equals(Object)} and {@link #hashCode()} to compare these aspects. | ||
* Comparisons are very frequent, so these methods need to be fast. | ||
* | ||
* File fingerprints are cached between builds, so their memory footprint should be kept to a minimum. | ||
*/ | ||
public interface FileSystemLocationFingerprint extends Comparable<FileSystemLocationFingerprint>, Hashable { | ||
HashCode DIR_SIGNATURE = Hashing.signature("DIR"); | ||
HashCode MISSING_FILE_SIGNATURE = Hashing.signature("MISSING"); | ||
|
||
String getNormalizedPath(); | ||
HashCode getNormalizedContentHash(); | ||
FileType getType(); | ||
} |
49 changes: 49 additions & 0 deletions
49
...s/snapshots/src/main/java/org/gradle/internal/fingerprint/FingerprintHashingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2019 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.gradle.internal.fingerprint; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import org.gradle.internal.hash.Hasher; | ||
|
||
import java.util.Collection; | ||
|
||
/** | ||
* Strategy for appending a collection of fingerprints to a hasher. | ||
*/ | ||
public enum FingerprintHashingStrategy { | ||
SORT { | ||
@Override | ||
public void appendToHasher(Hasher hasher, Collection<FileSystemLocationFingerprint> fingerprints) { | ||
ImmutableList<FileSystemLocationFingerprint> sortedFingerprints = ImmutableList.sortedCopyOf(fingerprints); | ||
appendCollectionToHasherKeepingOrder(hasher, sortedFingerprints); | ||
} | ||
}, | ||
KEEP_ORDER { | ||
@Override | ||
public void appendToHasher(Hasher hasher, Collection<FileSystemLocationFingerprint> fingerprints) { | ||
appendCollectionToHasherKeepingOrder(hasher, fingerprints); | ||
} | ||
}; | ||
|
||
public abstract void appendToHasher(Hasher hasher, Collection<FileSystemLocationFingerprint> fingerprints); | ||
|
||
protected void appendCollectionToHasherKeepingOrder(Hasher hasher, Collection<FileSystemLocationFingerprint> fingerprints) { | ||
for (FileSystemLocationFingerprint fingerprint : fingerprints) { | ||
fingerprint.appendToHasher(hasher); | ||
} | ||
} | ||
} |
Oops, something went wrong.