-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetching dependencies declared in swift-java.config (#191)
- Loading branch information
Showing
45 changed files
with
1,872 additions
and
471 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC2034 | ||
declare -r GREEN='\033[0;32m' | ||
declare -r BOLD='\033[1m' | ||
declare -r RESET='\033[0m' | ||
|
||
declare -r sampleDir="$1" | ||
declare -r CI_VALIDATE_SCRIPT='ci-validate.sh' | ||
|
||
echo "" | ||
echo "" | ||
echo "========================================================================" | ||
printf "Validate sample '${BOLD}%s${RESET}' using: " "$sampleDir" | ||
cd "$sampleDir" || exit | ||
if [[ $(find . -name ${CI_VALIDATE_SCRIPT} -maxdepth 1) ]]; then | ||
echo -e "Custom ${BOLD}${CI_VALIDATE_SCRIPT}${RESET} script..." | ||
./${CI_VALIDATE_SCRIPT} || exit | ||
elif [[ $(find . -name 'build.gradle*' -maxdepth 1) ]]; then | ||
echo -e "${BOLD}Gradle${RESET} build..." | ||
./gradlew build || ./gradlew build --info # re-run to get better failure output | ||
else | ||
echo -e "${BOLD}SwiftPM${RESET} build..." | ||
swift build || exit | ||
fi | ||
|
||
echo -e "Validated sample '${BOLD}${sampleDir}${RESET}': ${BOLD}passed${RESET}." | ||
cd - || exit | ||
|
||
echo | ||
printf "Done validating sample: %s" "${sampleDir}" | ||
echo -e "${GREEN}done${RESET}." |
This file was deleted.
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
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,77 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift.org project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Swift.org project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
plugins { | ||
id("build-logic.java-library-conventions") | ||
} | ||
|
||
group = "org.swift.javakit" | ||
version = "1.0-SNAPSHOT" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(22)) | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation("dev.gradleplugins:gradle-api:8.10.1") | ||
|
||
testImplementation(platform("org.junit:junit-bom:5.10.0")) | ||
testImplementation("org.junit.jupiter:junit-jupiter") | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
||
// Copy the gradle wrapper we're using into the resulting jar's resources. | ||
// We'll use it to bootstrap dependencies (and gradle!) if there is none yet. | ||
tasks.processResources { | ||
from('gradlew') { | ||
into 'gradle/' | ||
} | ||
from('gradlew.bat') { | ||
into 'gradle/' | ||
} | ||
from('../gradle/wrapper/gradle-wrapper.jar') { | ||
into 'gradle/wrapper/' | ||
} | ||
from('../gradle/wrapper/gradle-wrapper.properties') { | ||
into 'gradle/wrapper/' | ||
} | ||
} | ||
|
||
//task fatJar(type: Jar) { | ||
// archiveBaseName = 'java-kit-fat-jar' | ||
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
// from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
// with jar | ||
//} | ||
|
||
// Task necessary to bootstrap | ||
task printRuntimeClasspath { | ||
def runtimeClasspath = sourceSets.main.runtimeClasspath | ||
inputs.files(runtimeClasspath) | ||
doLast { | ||
println("CLASSPATH:${runtimeClasspath.asPath}") | ||
} | ||
} |
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 @@ | ||
../gradlew |
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 @@ | ||
../gradlew.bat |
28 changes: 28 additions & 0 deletions
28
JavaKit/src/main/java/org/swift/javakit/annotations/UsedFromSwift.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,28 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift.org open source project | ||
// | ||
// Copyright (c) 2024 Apple Inc. and the Swift.org project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Swift.org project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
package org.swift.javakit.annotations; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
* Since some public methods may not appear as used in Java source code, but are used by Swift, | ||
* we can use this source annotation to mark such entry points to not accidentally remove them with | ||
* "safe delete" refactorings in Java IDEs which would be unaware of the usages from Swift. | ||
*/ | ||
@SuppressWarnings("unused") // used from Swift | ||
@Retention(RetentionPolicy.SOURCE) | ||
public @interface UsedFromSwift { | ||
} |
Oops, something went wrong.