Skip to content

Commit

Permalink
Merge pull request #1 from Nuvindu/initial-version
Browse files Browse the repository at this point in the history
Add the initial implementation of the XSD tool
  • Loading branch information
Nuvindu authored Dec 22, 2024
2 parents b3c08d9 + 276522b commit 8f0a662
Show file tree
Hide file tree
Showing 108 changed files with 30,598 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ensure all Java files use LF.
*.java eol=lf
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# See: https://help.github.com/articles/about-codeowners/

# These owners will be the default owners for everything in the repo.
* @NipunaRanasinghe @Nuvindu @shafreenAnfar
36 changes: 36 additions & 0 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build
on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
latestCommit=$(git log -n 1 --pretty=format:"%h")
VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)
updatedVersion=$VERSION-$startTime-$latestCommit
echo $updatedVersion
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
nexusUser: ${{ secrets.NEXUS_USERNAME }}
nexusPassword: ${{ secrets.NEXUS_PASSWORD }}
run: |
./gradlew clean build publish --stacktrace --scan --console=plain
52 changes: 52 additions & 0 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish to the Ballerina central

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Ballerina Central Dev Push
if: ${{ github.event.inputs.environment == 'DEV CENTRAL' }}
env:
BALLERINA_DEV_CENTRAL: true
BALLERINA_STAGE_CENTRAL: false
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties
./gradlew clean build -PpublishToCentral=true
- name: Ballerina Central Stage Push
if: ${{ github.event.inputs.environment == 'STAGE CENTRAL' }}
env:
BALLERINA_DEV_CENTRAL: false
BALLERINA_STAGE_CENTRAL: true
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_STAGE_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
sed -i 's/version=\(.*\)-SNAPSHOT/version=\1/g' gradle.properties
./gradlew clean build -PpublishToCentral=true
41 changes: 41 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PR build

on:
pull_request:

jobs:
ubuntu-build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build --stacktrace --scan --console=plain --no-daemon
windows-build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
run: ./gradlew.bat build --stacktrace --scan --console=plain --no-daemon
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,25 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### Gradle ###
.gradle
build/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store

### Generated Files ###
target/
48 changes: 48 additions & 0 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2024, WSO2 Inc. (http://www.wso2.com).
*
* 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.
*
*/

plugins {
id "de.undercouch.download"
}

apply plugin: 'java'

task downloadCheckstyleRuleFiles(type: Download) {
src([
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/checkstyle.xml',
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/suppressions.xml'
])
overwrite false
onlyIfNewer true
dest buildDir
}

jar {
enabled = false
}

clean {
enabled = false
}

artifacts.add('default', file("$project.buildDir/checkstyle.xml")) {
builtBy('downloadCheckstyleRuleFiles')
}

artifacts.add('default', file("$project.buildDir/suppressions.xml")) {
builtBy('downloadCheckstyleRuleFiles')
}
9 changes: 9 additions & 0 deletions build-config/resources/package/BalTool.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool]
id = "xsd"

[[dependency]]
path = "lib/[email protected]@.jar"

[[dependency]]
path = "lib/[email protected]@.jar"

12 changes: 12 additions & 0 deletions build-config/resources/package/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
distribution = "2201.11.0"
org = "ballerina"
name = "xsdtool"
version = "@toml.version@"
authors = ["Ballerina"]
keywords = ["xsd", "xsd-tool"]
repository = "https://github.com/ballerina-platform/xsd-tools"
license = ["Apache-2.0"]

[build-options]
observabilityIncluded = false
99 changes: 99 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com)
*
* WSO2 LLC. licenses this file to you 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.
*/

plugins {
id "com.github.spotbugs-base" version "${spotbugsPluginVersion}"
id "com.github.johnrengelman.shadow" version "${shadowJarPluginVersion}"
id "de.undercouch.download" version "${downloadPluginVersion}"
id "net.researchgate.release" version "${releasePluginVersion}"
}

allprojects {
group = project.group
version = project.version

apply plugin: 'jacoco'
apply plugin: 'maven-publish'

repositories {
mavenLocal()
maven {
url = 'https://maven.wso2.org/nexus/content/repositories/releases/'
}
maven {
url = 'https://maven.wso2.org/nexus/content/groups/wso2-public/'
}

maven {
url = 'https://maven.wso2.org/nexus/content/repositories/orgballerinalang-1614'
}

maven {
url = 'https://repo.maven.apache.org/maven2'
}

maven {
url = 'https://maven.pkg.github.com/ballerina-platform/*'
credentials {
username System.getenv("packageUser")
password System.getenv("packagePAT")
}
}

maven {
url "https://plugins.gradle.org/m2/"
}
}

ext {
snapshotVersion= '-SNAPSHOT'
timestampedVersionRegex = '.*-\\d{8}-\\d{6}-\\w.*\$'
}
}

def moduleVersion = project.version.replace("-SNAPSHOT", "")

release {
failOnPublishNeeded = false
failOnSnapshotDependencies = true

buildTasks = ['build']
versionPropertyFile = 'gradle.properties'
tagTemplate = 'v$version'

git {
requireBranch = "release-${moduleVersion}"
pushToRemote = 'origin'
}
}

tasks.register('clean') {
dependsOn(":module-ballerina-xsd:clean")
}

tasks.register('build') {
dependsOn(":module-ballerina-xsd:build")
}

tasks.register('test') {
dependsOn(":module-ballerina-xsd:test")
dependsOn(":xsd-core:test")
}

publishToMavenLocal.dependsOn build
publish.dependsOn build
22 changes: 22 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
org.gradle.caching=true
group=io.ballerina
version=0.1.0-SNAPSHOT

# Dependencies
ballerinaLangVersion=2201.10.0
checkstylePluginVersion=10.12.0
spotbugsPluginVersion=5.0.14
shadowJarPluginVersion=8.1.1
downloadPluginVersion=5.4.0
releasePluginVersion=2.8.0

xsd4jVersion=1.6.3
apacheXmlSchemaVersion=1.4.7
picocliVersion=4.0.1
junitVersion=4.13.1
junitEngineVersion=5.8.2
junitParamVersion=5.10.1
testngVersion=7.7.0

# Stdlib Level 01
stdlibIoVersion=1.6.0
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 8f0a662

Please sign in to comment.