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
Showing
861 changed files
with
1,484 additions
and
1,098 deletions.
There are no files selected for viewing
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
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,11 @@ | ||
/* | ||
* Minecraft Dev for IntelliJ | ||
* | ||
* https://minecraftdev.org | ||
* | ||
* Copyright (c) 2022 minecraft-dev | ||
* | ||
* MIT License | ||
*/ | ||
|
||
rootProject.name = "buildSrc" |
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,102 @@ | ||
/* | ||
* Minecraft Dev for IntelliJ | ||
* | ||
* https://minecraftdev.org | ||
* | ||
* Copyright (c) 2022 minecraft-dev | ||
* | ||
* MIT License | ||
*/ | ||
|
||
import com.google.gson.Gson | ||
import com.google.gson.reflect.TypeToken | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import javax.inject.Inject | ||
import org.gradle.api.artifacts.transform.CacheableTransform | ||
import org.gradle.api.artifacts.transform.InputArtifact | ||
import org.gradle.api.artifacts.transform.TransformAction | ||
import org.gradle.api.artifacts.transform.TransformOutputs | ||
import org.gradle.api.artifacts.transform.TransformParameters | ||
import org.gradle.api.file.FileSystemLocation | ||
import org.gradle.api.file.ProjectLayout | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.PathSensitive | ||
import org.gradle.api.tasks.PathSensitivity | ||
|
||
abstract class Filter : TransformAction<Filter.Params> { | ||
interface Params : TransformParameters { | ||
@get:Input | ||
val ideaVersion: Property<String> | ||
@get:Input | ||
val ideaVersionName: Property<String> | ||
@get:PathSensitive(PathSensitivity.NONE) | ||
@get:InputFile | ||
val depsFile: RegularFileProperty | ||
} | ||
|
||
@get:PathSensitive(PathSensitivity.NONE) | ||
@get:InputArtifact | ||
abstract val inputArtifact: Provider<FileSystemLocation> | ||
|
||
@get:Inject | ||
abstract val layout: ProjectLayout | ||
|
||
private val deps: List<Dep>? | ||
|
||
init { | ||
deps = run { | ||
val depsFile = parameters.depsFile.orNull?.asFile ?: return@run null | ||
if (!depsFile.exists()) { | ||
return@run null | ||
} | ||
|
||
val depList: DepList = depsFile.bufferedReader().use { reader -> | ||
Gson().fromJson(reader, DepList::class.java) | ||
} | ||
|
||
if ( | ||
parameters.ideaVersion.orNull == depList.intellijVersion && | ||
parameters.ideaVersionName.orNull == depList.intellijVersionName | ||
) { | ||
depList.deps | ||
} else { | ||
null | ||
} | ||
} | ||
} | ||
|
||
override fun transform(outputs: TransformOutputs) { | ||
val input = inputArtifact.get().asFile.toPath() | ||
|
||
// exclude the coroutines jar | ||
// We include our own - but also IntelliJ's jar breaks sources | ||
val inputParts = input.map { it.toString() } | ||
if (!inputParts.containsAll(pathParts)) { | ||
outputs.file(inputArtifact) | ||
return | ||
} | ||
|
||
val fileName = inputParts.last() | ||
if (fileName.startsWith("kotlinx-coroutines")) { | ||
return | ||
} | ||
|
||
deps?.forEach { d -> | ||
if (fileName == "${d.artifactId}-${d.version}.jar") { | ||
return | ||
} | ||
} | ||
|
||
outputs.file(inputArtifact) | ||
} | ||
|
||
companion object { | ||
private val pathParts = listOf("com.jetbrains.intellij.idea", "ideaIC", "lib") | ||
} | ||
} |
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
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
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
Binary file not shown.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
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
Oops, something went wrong.